package com.study.bootstudy.entity;

import cn.hutool.core.util.DesensitizedUtil;
import com.study.bootstudy.annoation.Sensitive;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;

/**
 * @Author RenPu
 * @Date 2021/7/30 18:24
 * @Version 1.0
 * @Description: 使用自定义注解结合hutool实现数据脱敏展示
 **/
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Person {
    private String name;
    private Integer age;
    private String gender;

    @Sensitive(DesensitizedUtil.DesensitizedType.MOBILE_PHONE)
    private String phone;

    @Sensitive(DesensitizedUtil.DesensitizedType.ID_CARD)
    private String idNumber;


    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getIdNumber() {
        return idNumber;
    }

    public void setIdNumber(String idNumber) {
        this.idNumber = idNumber;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", gender='" + gender + '\'' +
                '}';
    }
}
